﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:49
 ******************************************************************************/
//--------------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2012 , gt TECH, Ltd.
//--------------------------------------------------------------------

using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
  using RDIFramework.Utilities;

 /// <summary>
 /// CiSequenceEntity
 /// 序列产生器表
 ///
 /// 修改纪录
 ///
 ///		2012-03-02 版本：1.0 EricHu 创建主键。
 ///
 /// 版本：1.0
 ///
 /// <author>
 ///		<name>EricHu</name>
 ///		<date>2012-03-02</date>
 /// </author>
 /// </summary>
 [Serializable]
 public partial class CiSequenceEntity
 {
  private int? id = null;
  /// <summary>
  /// 主键
  /// </summary>
  public int? Id
  {
      get
      {
          return this.id;
      }
      set
      {
          this.id = value;
      }
  }

  private String fullName = string.Empty;
  /// <summary>
  /// 名称
  /// </summary>
  public String FullName
  {
      get
      {
          return this.fullName;
      }
      set
      {
          this.fullName = value;
      }
  }

  private String prefix = string.Empty;
  /// <summary>
  /// 序列号前缀
  /// </summary>
  public String Prefix
  {
      get
      {
          return this.prefix;
      }
      set
      {
          this.prefix = value;
      }
  }

  private String separate = string.Empty;
  /// <summary>
  /// 序列号分隔符
  /// </summary>
  public String Separate
  {
      get
      {
          return this.separate;
      }
      set
      {
          this.separate = value;
      }
  }

  private int? sequence = 10000000;
  /// <summary>
  /// 升序序列
  /// </summary>
  public int? Sequence
  {
      get
      {
          return this.sequence;
      }
      set
      {
          this.sequence = value;
      }
  }

  private int? reduction = 9999999;
  /// <summary>
  /// 倒序序列
  /// </summary>
  public int? Reduction
  {
      get
      {
          return this.reduction;
      }
      set
      {
          this.reduction = value;
      }
  }

  private int? step = 1;
  /// <summary>
  /// 步骤
  /// </summary>
  public int? Step
  {
      get
      {
          return this.step;
      }
      set
      {
          this.step = value;
      }
  }

  private DateTime? createOn = DateTime.Now;
  /// <summary>
  /// 创建日期
  /// </summary>
  public DateTime? CreateOn
  {
      get
      {
          return this.createOn;
      }
      set
      {
          this.createOn = value;
      }
  }

  private String description = string.Empty;
  /// <summary>
  /// 描述
  /// </summary>
  public String Description
  {
      get
      {
          return this.description;
      }
      set
      {
          this.description = value;
      }
  }

  /// <summary>
  /// 构造函数
  /// </summary>
  public CiSequenceEntity()
  {
  }

  /// <summary>
  /// 构造函数
  /// </summary>
  /// <param name="dataRow">数据行</param>
  public CiSequenceEntity(DataRow dataRow)
  {
      this.GetFrom(dataRow);
  }

  /// <summary>
  /// 构造函数
  /// </summary>
  /// <param name="dataReader">数据流</param>
  public CiSequenceEntity(IDataReader dataReader)
  {
      this.GetFrom(dataReader);
  }

  /// <summary>
  /// 构造函数
  /// </summary>
  /// <param name="dataTable">数据表</param>
  public CiSequenceEntity(DataTable dataTable)
  {
      this.GetFrom(dataTable);
  }

  /// <summary>
  /// 从数据表读取
  /// </summary>
  /// <param name="dataTable">数据表</param>
  public CiSequenceEntity GetFrom(DataTable dataTable)
  {
      if ((dataTable == null) || (dataTable.Rows.Count == 0))
      {
          return null;
      }
      foreach (DataRow dataRow in dataTable.Rows)
      {
          this.GetFrom(dataRow);
          break;
      }
      return this;
  }

  /// <summary>
  /// 从数据行读取
  /// </summary>
  /// <param name="dataRow">数据行</param>
  public CiSequenceEntity GetFrom(DataRow dataRow)
  {
      this.Id = BusinessLogic.ConvertToInt(dataRow[CiSequenceTable.FieldId]);
      this.FullName = BusinessLogic.ConvertToString(dataRow[CiSequenceTable.FieldFullName]);
      this.Prefix = BusinessLogic.ConvertToString(dataRow[CiSequenceTable.FieldPrefix]);
      this.Separate = BusinessLogic.ConvertToString(dataRow[CiSequenceTable.FieldSeparate]);
      this.Sequence = BusinessLogic.ConvertToInt(dataRow[CiSequenceTable.FieldSequence]);
      this.Reduction = BusinessLogic.ConvertToInt(dataRow[CiSequenceTable.FieldReduction]);
      this.Step = BusinessLogic.ConvertToInt(dataRow[CiSequenceTable.FieldStep]);
      this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[CiSequenceTable.FieldCreateOn]);
      this.Description = BusinessLogic.ConvertToString(dataRow[CiSequenceTable.FieldDescription]);
      return this;
  }

  /// <summary>
  /// 从数据流读取
  /// </summary>
  /// <param name="dataReader">数据流</param>
  public CiSequenceEntity GetFrom(IDataReader dataReader)
  {
      this.Id = BusinessLogic.ConvertToInt(dataReader[CiSequenceTable.FieldId]);
      this.FullName = BusinessLogic.ConvertToString(dataReader[CiSequenceTable.FieldFullName]);
      this.Prefix = BusinessLogic.ConvertToString(dataReader[CiSequenceTable.FieldPrefix]);
      this.Separate = BusinessLogic.ConvertToString(dataReader[CiSequenceTable.FieldSeparate]);
      this.Sequence = BusinessLogic.ConvertToInt(dataReader[CiSequenceTable.FieldSequence]);
      this.Reduction = BusinessLogic.ConvertToInt(dataReader[CiSequenceTable.FieldReduction]);
      this.Step = BusinessLogic.ConvertToInt(dataReader[CiSequenceTable.FieldStep]);
      this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[CiSequenceTable.FieldCreateOn]);
      this.Description = BusinessLogic.ConvertToString(dataReader[CiSequenceTable.FieldDescription]);
      return this;
  }
  }
}
